package org.nfr;

import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.reasoner.OWLReasoner;

public class ConflictDetector {
    private final OWLOntology ontology;
    private final OWLReasoner reasoner;

    public ConflictDetector(OWLOntology ontology, OWLReasoner reasoner) {
        this.ontology = ontology;
        this.reasoner = reasoner;
    }

    public void detectConflicts() {
        System.out.println("[Info] Running conflict detection...");
        OWLDataFactory factory = ontology.getOWLOntologyManager().getOWLDataFactory();
        OWLClass competition = factory.getOWLClass(IRI.create("http://example.org/nfrco#Competition"));

        boolean found = false;
        for (OWLNamedIndividual ind : ontology.getIndividualsInSignature()) {
            if (reasoner.getTypes(ind, false).containsEntity(competition)) {
                found = true;
                System.out.println("⚠️ 推理得到的 Competition 实例: " + ind.getIRI().getShortForm());
            }
        }
        if (!found) {
            System.out.println("✅ 没有检测到 Competition 实例");
        }
    }
}
